﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace KlageSystem
{
    public partial class DBTest : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var str = ConnectionManager.GetConnStr();

            using (SqlConnection conn = new SqlConnection(str))
            {
                try
                {
                    conn.Open();
                    var sqlStr = "select * from org_klagedata order by org_klagenr";
                    var sqlCommand = new SqlCommand(sqlStr, conn);
                    var sqlReader = sqlCommand.ExecuteReader();

                    var found = 0;
                    while (sqlReader.Read())
                    {
                        found++;
                    }
                    Label1.Text = "Success - found : " + found;
                }
                catch (SqlException ex)
                {
                    Label1.Text = ex.Message;
                    Label1.Text += ex.Message;
                }
                finally
                {
                    conn.Close();
                }
            }


        }
    }
}